import React, { CSSProperties, FC } from 'react'
import { Space, Button } from 'antd'

const buttonWrapStyle: CSSProperties = {
    position: 'absolute',
    bottom: 0,
    left: 0,
    width: '100%',
    height: 50,
    display: 'flex',
    justifyContent: 'flex-end',
    alignItems: 'center',
    padding: '0 10px',
    borderTop: '1px solid #ccc',
    backgroundColor: '#fff',
    zIndex: 99
}

interface Iprops {
    onClose(): void
    loading?: boolean
    onOk?(): void
}

const buttonWrap: FC<Iprops> = (props) => {
    const { onClose, loading, onOk } = props

    return (
        <div style={{ ...buttonWrapStyle }}>
            <Space>
                <Button onClick={onClose}>取消</Button>
                <Button type='primary' htmlType='submit' loading={loading} onClick={() => {
                    onOk && onOk()
                }}>提交</Button>
            </Space>
        </div>
    )
}

export default buttonWrap
